<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.yaodian100.core.common.utils.ServerValue"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ include file="/taglibs.jsp"%> 
<h1>商品管理 - 商品上下架(检视)<br/>
<div class="f-link">
	<yaodian100:checkPermission permissions="ROLE_PM_MANAGER,MANAGER_A-20-200-100">
		<a href="<%=ServerValue.getMidContextPath()%>/shelf/searchApprove.do">回商品上架檔审核列表页</a>
	</yaodian100:checkPermission>
	<a href="<%=ServerValue.getMidContextPath()%>/shelf2/list.do?productId=${productId}">回上下架列表页</a>
	<a href="<%=ServerValue.getMidContextPath()%>/product/list.do">回商品列表页</a>
</div>
</h1>
<s:actionerror />
<s:actionmessage />
<s:fielderror />
<script language="javascript">
	$().ready(function(){
		if ( "" != "${shelf.shelfPrice}" )
			$("#rate").text(round2places(("${shelf.shelfPrice}" - "${product.productCost}")/"${shelf.shelfPrice}"*100)+"%");
	});
	//取到小数点第二位
	function round2places(numToRound){ 
		var result; 
		result=numToRound*100; 
		result=Math.round(result); 
		result=result/100; 
		return result;
	}	
</script>
<c-rt:if test="${not empty product.productId}">
	<jsp:include page="/WEB-INF/jsp/product/commonMenu2.jsp"/>
</c-rt:if>
<table class="tb-data" width="100%">	
 	<tr>
		<th>商品名称（商品编号)</th>			
		<td>${product.productName}(${product.productId})</td>
	</tr>
	<tr>
		<th>商品促销小标</th>			
		<td>${shelf.promoteName}</td>
	</tr>
  <tr>
		<th>上架起始日期时间</th>			
		<td><fmt:formatDate value="${shelf.startDate}" pattern="yyyy-MM-dd HH:mm" /></td>
	</tr>
  <tr>
		<th>上架结束日期时间</th>			
		<td><fmt:formatDate value="${shelf.endDate}" pattern="yyyy-MM-dd HH:mm" /></td>
	</tr>
  <tr>
		<th>上架售价</th>			
		<td>        
		 <fmt-rt:formatNumber pattern="######0.0" value="${shelf.shelfPrice}"/>
	   <span class="txt-rd">【※上架售价小数点1位数后无条件舍去】</span><br/>
	   <table  class="tb-data" width="100%">
	   	<tr>
	   		<th>厂商建议售价</th>
	   		<th>提报耀点价</th>
	   		<th>商品成本</th>
	   		<th>分类毛利率限制</th>
			<th>实际毛利率</th>
	   	</tr>
	   	<tr>
	   		<td style="text-align: center;"><fmt-rt:formatNumber pattern="######0.0" value="${product.listPrice}"/></td>
	   		<td style="text-align: center;"><fmt-rt:formatNumber pattern="######0.0" value="${product.prpsShelfPrice}"/></td>
	   		<td style="text-align: center;"><fmt-rt:formatNumber pattern="######0.00" value="${product.productCost}"/></td>
	   		<td style="text-align: center;" class="txt-rd"><fmt-rt:formatNumber pattern="######0.0" value="${grossProfit}"/></td>
			<td style="text-align: center;"><span id="rate"></span></td>
	   	</tr>
	   </table>
    </td>
	</tr>
 	<tr>
		<th>上架类别</th>			
		<td>${shelfTypeMenu.options[shelf.shelfType].name}</td>
  </tr>	
 	<tr>
		<th>上架状态</th>			
		<td>${shelfStatusMenu.options[shelf.shelfStatus].name}</td>
  </tr>
  <tr>
		<th>备注</th>			
		<td>${fn:escapeXml(shelf.shelfMemo)}</td>        
	</tr>
  <c-rt:if test="${not empty shelf.shelfId}">
  <tr>
  	<th>申请人</th>
  	<td>${shelf.createUser}</td>
  </tr>
  <tr>
  	<th>申请时间</th>
  	<td><fmt-rt:formatDate value="${shelf.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
  </tr>
  <tr>
  	<th>审核人员</th>
  	<td>${shelf.approveUser}</td>
  </tr>
  <tr>
  	<th>审核时间</th>
  	<td><fmt-rt:formatDate value="${shelf.approveDate}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
  </tr>  
  <tr>
  	<th>不同意原因</th>
  	<td>${shelf.approveFailReason}</td>
  </tr>	  	  
  </c-rt:if>	
</table>
<br/>
<p>售价记录</p>
<table class="tb-1" width="100%">
	<thead>
		<tr>
			<th>上架类别</th>
			<th>日期起</th>
			<th>日期迄</th>
			<th>小标</th>
			<th>售价</th>
			<th>申请人</th>
			<th>申请状态</th>
			<th>申请时间</th>
			<th>异动人</th>
			<th>异动时间</th>
		</tr>
	</thead>
	<tbody>
		<c-rt:forEach items="${shelfHistoryList}" var="shelf" >
			<tr>
				<td>${shelfTypeMenu.options[shelf['SHELF_TYPE']].name}</td>
				<td><fmt-rt:formatDate value="${shelf['START_DATE']}" pattern="yyyy-MM-dd HH:mm"/></td>
				<td><fmt-rt:formatDate value="${shelf['END_DATE']}" pattern="yyyy-MM-dd HH:mm"/></td>
				<td>${shelf['PROMOTE_NAME']}</td>
				<td><fmt-rt:formatNumber value="${shelf['SHELF_PRICE']}" pattern="######0.0"/></td>
				<td>${shelf['CREATE_USER']}</td>
				<td>${shelfStatusMenu.options[shelf['SHELF_STATUS']].name}</td>
				<td><fmt-rt:formatDate value="${shelf['CREATE_DATE']}" pattern="yyyy-MM-dd HH:mm"/></td>
				<td>${shelf['MODIFY_USER']}</td>
				<td><fmt-rt:formatDate value="${shelf['MODIFY_DATE']}" pattern="yyyy-MM-dd HH:mm"/></td>
			</tr>
		</c-rt:forEach>
	</tbody>
</table>
